package com.example.texted.cyclicbarrier;

import java.util.concurrent.CyclicBarrier;

public class Do {
    public static void main(String[] args) {
        CyclicBarrier cyclicBarrier = new CyclicBarrier(2, () -> {
            System.out.println("隧道已打通");
        });
        new Thread(new Worker(cyclicBarrier),"工人1").start();
        new Thread(new Worker(cyclicBarrier),"工人2").start();
    }
}
